﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CodeMetricsCheckInPolicy
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists("C:\\CustomCheckinPolicies"))
            {
                Directory.CreateDirectory("C:\\CustomCheckinPolicies");
            }
            StreamWriter sw = new StreamWriter("C:\\CustomCheckinPolicies\\MetricValue.txt",false);
            sw.WriteLine(textBox1.Text);
            sw.Flush();
            sw.Close();
            this.Close();
        }
    }
}
